<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>文章列表--layui后台管理模板 2.0</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet"href="/ssm/static/system/layui/css/layui.css" media="all" />
	<link rel="stylesheet"href="/ssm/static/system/css/public.css" media="all" />
	<link rel="stylesheet"href="/ssm/static/common/js/zTree/css/zTreeStyle/zTreeStyle.css" media="all" />
</head>
<body layadmin-themealias="default">

<div class="layui-fluid">
	<div class="layui-row layui-col-space15">
		<div class="layui-col-md12">
			<div class="layui-card">
				<div class="layui-card-header">修改密码</div>
				<div class="layui-card-body" pad15="">
						<form class="layui-form" lay-filter="userUpdatePwdForm">
							<div class="layui-form-item">
								<label class="layui-form-label">当前密码</label>
								<div class="layui-input-inline">
									<input type="password" id="oldPassword" lay-verify="required" lay-vertype="tips" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">新密码</label>
								<div class="layui-input-inline">
									<input type="password" id="password" lay-verify="pass" lay-vertype="tips" autocomplete="off" id="LAY_password" class="layui-input">
								</div>
								<div class="layui-form-mid layui-word-aux"></div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">确认新密码</label>
								<div class="layui-input-inline">
									<input type="password" id="repassword" lay-verify="repass" lay-vertype="tips" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<div class="layui-input-block">
									<button class="layui-btn" lay-submit="" lay-filter="setmypass">确认修改</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript"src="/ssm/static/system/layui/layui.js"></script>
<script type="text/javascript"src="/ssm/static/common/js/jquery/jquery-3.2.1.min.js"inline="none"></script>
<script type="text/javascript"src="/ssm/static/common/js/zTree/js/jquery.ztree.core.min.js"inline="none"></script>
<script type="text/javascript">
layui.use('form', function(){
  var form = layui.form;
	 //修改密码
    form.on("submit(setmypass)",function(data){
    	if ($("#password").val() != $("#repassword").val()) {
			top.layer.alert("输入的密码不一致，请重新输入");
			return false;
		 }

        var index = layer.msg('提交中，请稍候',{icon: 16,time:false,shade:0.8});
		var oldPassword = $("#oldPassword").val();
		var repassword = $("#repassword").val();
		var password = $("#password").val();
		 var postData = {
			oldPassword:oldPassword,
			password:password,
		 }
		 $.post("/ssm/updatepassword.do",postData,function(data){
			var code = data.code;
			if(code=="01"){
				layer.close(index);
				layer.msg("密码修改成功！");
			}else{
				layer.msg("当前密码不正确,密码修改失败！");
			}
		 })
        return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
    })
});
</script>
</body>
</html>